/* **********************************************************************************
 *
 * Copyright (c) Ascend.NET Project. All rights reserved.
 *
 * This source code is subject to terms and conditions of the Shared Source License
 * for Ascend. A copy of the license can be found in the License.html file
 * at the root of this distribution. If you can not locate the Shared Source License
 * for Ascend, please send an email to ascendlic@<TBD>.
 * By using this source code in any fashion, you are agreeing to be bound by
 * the terms of the Shared Source License for Ascend.NET.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * **********************************************************************************/

using System;
using System.ComponentModel;
using System.Reflection;

namespace Ascend.Resources
{
    /// <summary>
    /// Specifies a description for a property or event.
    /// </summary>
    [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
    public sealed class ResourceDescriptionAttribute : DescriptionAttribute
    {
        private bool _localized;

        /// <summary>
        /// Gets the description stored in this attribute.
        /// </summary>
        public override string Description
        {
            get
            {
                if (!this._localized)
                {
                    this._localized = true;

                    System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("Ascend.Resources.DefaultResource", Assembly.GetExecutingAssembly()); ;
                    this.DescriptionValue = resourceManager.GetString(this.DescriptionValue);

                }

                return base.Description;

            }

        }

        /// <summary>
        /// Initializes a new instance of the ResourceDescriptionAttribute class.
        /// </summary>
        /// <param name="description">The resouce name.</param>
        public ResourceDescriptionAttribute(string description) : base(description)
        {
        }

    }

}
